<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="get" action="">
            <i>Pesquisar</i>
            
            <?php
                $html = '<select id="anfiltro" name="anfiltro" class="f_s_tam_peq" >';
                for($i = date('Y'); $i >= 2014; $i--){   
                    $select = $this->anfiltro == $i ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$i.'">'.$i.'</option>'; 
                }
                $html .= '</select>';
                echo $html;
                
            ?>
            
            &nbsp;
			
            <input type="text" id="dtfiltro" name="dtfiltro" style="width:70px !important" class="data" placeholder="Data" value="<?php echo $this->dtfiltro?>" />
            
            &nbsp;
            <?php
            
                $query = 'SELECT SQL_CACHE USU_ID,USU_NOME,t.TUS_NOM FROM USUARIOS u, TIPO_USUARIO t WHERE u.TUS_ID = t.TUS_ID AND USU_STA = 1 ORDER BY TUS_NOM,USU_NOME';
                $f_cur = $this->db->fetchAll($query);

                $html = '<select id="cbfiltro" name="cbfiltro" class="chosen-select" style="width: 200px;">';
                $html .= '<option value="">Todos usuários</option>';
                foreach($f_cur as $r){   
                    $select = $this->cbfiltro == $r['USU_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['USU_ID'].'">'.$r['TUS_NOM'].' - '.$r['USU_NOME'].'</option>'; 
                }
                $html .= '</select>';
                echo $html;
                
            ?>
            
            &nbsp;
            <?php
            
                $query = 'SELECT SQL_CACHE MOD_NOME,MOD_ARQUIVO,MOD_TPOSIS FROM MODULOS WHERE MOD_ATIVO = 1 ORDER BY MOD_TPOSIS,MOD_NOME';
                $f_cur = $this->db->fetchAll($query);

                $html = '<select id="mdfiltro" name="mdfiltro" class="chosen-select" style="width: 130px;">';
                $html .= '<option value="">Todos módulos</option>';
                foreach($f_cur as $r){   
                    $select = $this->mdfiltro == $r['MOD_ARQUIVO'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['MOD_ARQUIVO'].'">'.dominio::getTpoSistemas($r['MOD_TPOSIS']).' - '.$r['MOD_NOME'].'</option>'; 
                }
                $html .= '</select>';
                echo $html;
                
            ?>
            
            &nbsp;
            <?php
            
                $f_cur = array('index','edit','delete');

                $html = '<select id="acfiltro" name="acfiltro" class="chosen-select" style="width: 115px;">';
                $html .= '<option value="">Todas ações</option>';
                foreach($f_cur as $r){   
                    $select = $this->acfiltro == $r ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r.'">'.$r.'</option>'; 
                }
                $html .= '</select>';
                echo $html;
                
            ?>
            
            &nbsp;
            
            <input type="text" id="dscfiltro" name="dscfiltro" style="width:70px !important" placeholder="Descrição" value="<?php echo $this->dscfiltro?>" />
            
            
            &nbsp;
            <?php
                $arr = dominio::tpoSistemas();
                $html = '';
                foreach($arr as $key => $value){   
                    $html .= '<label>'.elemform::radio('tpfiltro','tpfiltro',$key,$this->tpfiltro).$value.'</label>';
                }
                echo $html;                
            ?>
            
            <input type="submit" value="buscar" name="buscar" class="btn-pdr">
            
        </form>
    </div>
    <?php if($this->per_add){?>
    <div class="content-btn">
    </div>
    <?php } ?>
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    
    <table id="tlist">
        <thead>
            <tr>
                <th>Data</th>
                <th>Usuário</th>
                <th>IP</th>
                <th>Módulo</th>
                <th>Ação</th>
                <th>Cod. ID</th>
                <th>Sistema</th>
                <th>Forma</th>
                <th class="bc">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->result as $row) { ?>
                <tr>
                    <td><?php echo Datetools::amd_dma($row['ACE_DAT']).' '.$row['ACE_HOR']; ?></td>
                    <td><?php echo $row['USU_NOME']; ?></td>
                    <td><?php echo $row['ACE_IP']; ?></td>
                    <td><?php echo $row['ACE_CTL']; ?></td>
                    <td><?php echo $row['ACE_ACT']; ?></td>
                    <td><?php echo $row['ACE_COD']; ?></td>
                    <td><?php echo dominio::getTpoSistemas($row['ACE_TPO']); ?></td>
                    <td><?php echo strlen($row['ACE_PST']) > 0 ? 'POST':'GET'; ?></td>
                    <td class="bc">
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['ACE_ID'])); ?>">Registro</a><?php }?>
                        <?php /* if($this->per_del && $row['ACE_STA'] == 0){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['ACE_ID'] ?>, $(this));">Deletar</a><?php } */ ?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
<script>dataPicker($('#dtfiltro'));</script>